//
//  WXLSongsListCollectionViewCell.m
//  段子手
//
//  Created by dllo on 16/3/26.
//  Copyright © 2016年 JokesTeam. All rights reserved.
//

#import "WXLSongsListCollectionViewCell.h"

@interface WXLSongsListCollectionViewCell ()

@property (nonatomic, retain) UIImageView *bigImageView;
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UILabel *authorLabel;
@property (nonatomic, retain) UILabel *countLabel;

@end

@implementation WXLSongsListCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}


- (void)setModel:(WXLMusicListModel *)model {
    if (_model != model) {
        _model = model;
    }
    
    [_bigImageView HANDLEIMAGE(_model.pic_url)];
    _titleLabel.text = _model.title;
    _authorLabel.text = _model.author;
    _countLabel.text = _model.listen_count;
}



- (void)createSubView {
    self.bigImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.width * 1.0)];
    [self addSubview:_bigImageView];
    
    self.authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.bounds.size.width * 0.8, self.frame.size.width - 10, self.bounds.size.width * 0.2)];
    [self addSubview:_authorLabel];
    _authorLabel.font = [UIFont systemFontOfSize:15];
    _authorLabel.textColor = [UIColor whiteColor];
    
    self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width - 10, self.bounds.size.width * 0.2)];
    [self addSubview:_countLabel];
    _countLabel.textAlignment = NSTextAlignmentRight;
    _countLabel.font = [UIFont systemFontOfSize:15];
    _countLabel.textColor = [UIColor whiteColor];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _bigImageView.frame.size.height, self.bounds.size.width, self.bounds.size.width * 0.2)];
    [self addSubview:_titleLabel];
}

@end
